using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Runtime.Serialization;

namespace TemplateWeb.DTO
{
	/// <summary>
	/// Data transfer object which is associated with PhanHoi table in database
	/// </summary>
	public class PhanHoiDTO
	{
		public int ID { get; set; }
		public int IDHopThu { get; set; }
		public string NoiDungPhanHoi { get; set; }
		public string TenNguoiPhanHoi { get; set; }
		public DateTime NgayPhanHoi { get; set; }

		public static PhanHoiDTO Translate(DataRow row)
		{
			var dto = new PhanHoiDTO
			{
				ID = int.Parse(row["ID"].ToString()),
				IDHopThu = int.Parse(row["IDHopThu"].ToString()),
				NoiDungPhanHoi = row["NoiDungPhanHoi"].ToString(),
				TenNguoiPhanHoi = row["TenNguoiPhanHoi"].ToString(),
				NgayPhanHoi = DateTime.Parse(row["NgayPhanHoi"].ToString()),
			};
			return dto;
		}
	}
}